import request from '@/config/axios'

import { BaseModel } from '@/api/common/baseModel'

/**
 * 物料品牌
 */
export interface Model extends BaseModel {
    /**
     * 品牌图片
     */
    picUrl: string

    /**
     * 品牌描述
     */
    description?: string
}

// 更新物料品牌
export const update = (data: Model) => {

    return request.put({
        url: import.meta.env.VITE_BASE_ROLE + '/userCenter/inventory/consume/update.json',
        data
    })
}

// 删除物料品牌
export const del = (id: string) => {
    return request.delete({ url: import.meta.env.VITE_BASE_ROLE + `/userCenter/inventory/consume/del.json?id=${id}` })
}

// 获得物料品牌
export const getById = (id: string) => {
    return request.get({ url: import.meta.env.VITE_BASE_ROLE + `/userCenter/inventory/consume/getById.json?id=${id}` })
}

// 获得物料品牌列表
export const getPage = (params: PageParam) => {

    return request.get({
        url: import.meta.env.VITE_BASE_ROLE + '/userCenter/inventory/consume/page.json',
        params
    })
}

// 更新物料品牌
export const updateItem = (data: Model) => {
    return request.put({
        url: import.meta.env.VITE_BASE_ROLE + '/userCenter/inventory/consume/updateItem.json',
        data
    })
}

export const submit = (id: string) => {
    return request.get({ url: import.meta.env.VITE_BASE_ROLE + `/userCenter/inventory/consume/submit.json?id=${id}` })
}
